package com.nyt.org.modules.api.utils;

import com.alibaba.fastjson.JSONObject;
import com.nyt.org.modules.api.handler.*;
import com.nyt.org.modules.api.model.PublicRequest;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;

import javax.servlet.ServletResponse;

public class MethodsUtil {

    private static Logger log = LoggerFactory.getLogger(MethodsUtil.class);

    @Autowired
    public static void handlerMethods(String methodName, ServletResponse response, PublicRequest publicReq, JSONObject body) {
        switch (methodName) {
            case "zhonglv.station.query": {
                //售票站点数据获取
                TicketStationHandler.doMsgHandle(methodName,response,publicReq,body);
                break;
            }
            case "zhonglv.busplan.query": {
                //车次信息查询
                BusPlanHandler.doMsgHandle(methodName,response,publicReq,body);
                break;
            }
            case "zhonglv.lock.seat": {
                //下单锁座
                LockSeatHandler.doMsgHandle(methodName,response,publicReq,body);
                break;
            }
            case "zhonglv.ticket.out": {
                //出票
                TicketOutHandler.doMsgHandle(methodName,response,publicReq,body);
                break;
            }
            case "zhonglv.order.cancel": {
                //订单取消
                OrderCancelHandler.doMsgHandle(methodName,response,publicReq,body);
                break;
            }
            default: {
                log.info("暂不支持该方法: "+methodName);
                break;
            }
        }
    }


}
